<?php
/* @file show-problem.php
 * @author YangHuanFLC
 * @description php interface for show problem
 */

require_once("helper.php");
if(!InGroup(GROUP_SHOW_PROBLEM)){
	MsgBox(ACCESS_DENIED);
	exit();
}
try{

		$dwoo=new Dwoo();
		$tpl=new Dwoo_Template_File('template/show-problem.tpl');
		$data=new Dwoo_Data();

		$volume_name=$_GET['volume'];
		$name=$_GET['problem'];
		$bean=R::findOne("problem","name='$name' AND volume_name='$volume_name'");
		
		$bean=unserialize($bean["data"]);

		$language=R::findAndExport("language", "");
		
		$data->assign('problem', $bean);
		$data->assign('languages', $language);
		$data->assign('sharetronix_user_id',GetUserID());
		
		$dwoo->output($tpl,$data);
	}
	catch(Exception $e)
	{
		OJLog("Error in show-problem.php invoking Dwoo:". $e->getMessage());
	}
?>